package com.java3_20;

public class java3_20 {
    public static void main(String[] args) {
        //JUC就是操作线程的工具包

        //线程对共享数据的操作方式  --  创建共享数据类
        Ticket ticket = new Ticket(0);

        new Thread(()->{
            while (true) {
                ticket.addTicket();
            }
        },"001").start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    ticket.deleteTicket();
                }
            }
        },"002").start();

//        addTicket addTicket = new addTicket(ticket);
//        delTicket delTicket = new delTicket(ticket);
//
//        Thread thread1 = new Thread(addTicket);
//        thread1.start();
//        Thread thread2 = new Thread(delTicket);
//        thread2.start();

        //一般都是写好代码方法后在传递给run方法


    }
}
